class EmptyView extends egret.DisplayObjectContainer{

    private _iconImg:egret.Bitmap; // 图片
    private _label:BaseTextField; // 提示

    constructor(){
        super();
        this.addEventListener(egret.Event.ADDED_TO_STAGE, this.viewDidLoad, this);
    }

    private viewDidLoad(){
        // 1.图标
        if(!this.contains(this.iconImg)) this.addChild(this.iconImg);
        // 2.提示
        if(!this.contains(this.label)) this.addChild(this.label);
    }

    /*********************************************** getter **********************************************************/
    private get label():BaseTextField{
        if(!this._label){
            var label = new BaseTextField();
            label.text = "暂无数据";
            label.width = this.width;
            label.textColor = 0xb88b39;
            label.y = utils.getMaxY(this.iconImg) + 10;
            label.textAlign = egret.HorizontalAlign.CENTER;
            this._label = label;
        }
        return this._label;
    }

    private get iconImg():egret.Bitmap{
        if(!this._iconImg){
            var iconImg = utils.createBitmapByName('dj_icon');
            iconImg.x = (this.width - iconImg.width) / 2.0;
            this._iconImg = iconImg;
        }
        return this._iconImg;
    }
}